package com.macro.mall.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.macro.mall.common.util.BaseIdUtil;
import com.macro.mall.dao.pms.PmsProductAttributeLibMapper;
import com.macro.mall.dto.PmsProductAttributeLibQueryParam;
import com.macro.mall.model.pms.PmsProductAttributeLibDO;
import com.macro.mall.service.PmsProductAttributeLibDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 商品属性库(PmsProductAttributeLib)表服务实现类
 *
 * @author xchm
 * @since 2024-03-17 22:35:02
 */
@Service("pmsProductAttributeLibDomainService")
public class PmsProductAttributeLibDomainServiceImpl extends ServiceImpl<PmsProductAttributeLibMapper, PmsProductAttributeLibDO> implements PmsProductAttributeLibDomainService {

    @Autowired
    private PmsProductAttributeLibMapper pmsProductAttributeLibMapper;


    /**
     * 分页列表
     *
     * @param param 查询请求入参
     * @return 属性模版分页对象
     */
    @Override
    public Page<PmsProductAttributeLibDO> pageList(Page<PmsProductAttributeLibDO> page, PmsProductAttributeLibQueryParam param) {
        List<PmsProductAttributeLibDO>  list = pmsProductAttributeLibMapper.pageList(page, param);
        page.setRecords(list);
        return page;
    }



     /**
     * 保存记录
     *
     * @param item 入参
     * @return void
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveItem(PmsProductAttributeLibDO item){
        item.setId(BaseIdUtil.getId());
        pmsProductAttributeLibMapper.insert(item);
    }



    /**
     * 更新记录
     *
     * @param item 入参
     * @return void
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void updateItem(PmsProductAttributeLibDO item){
        pmsProductAttributeLibMapper.updateById(item);
    }
}

